﻿@using Church.Resources
@model IEnumerable<DataBaseLayer.Dto.ScheduleDayData>
@{
	ViewBag.Title = "Расписание богослужений";
}

@if (Model != null && Model.Any())
{
	<div class="schedule">
		<table>
			<tr>
				<td>Число</td>
				<td>Служба</td>
				<td>Время</td>
			</tr>
			@foreach (var day in Model)
			{
				<tr @Html.Raw(day.IsSpecialDay ? "class='table-special-day'" : string.Empty)>
					<td>
						@day.Day
						<br />
						@day.Date.ToString("dd MMMM", AppContext.CultureInfo)
					</td>
					<td>
						@if (day.ScheduleServices != null && day.ScheduleServices.Any())
						{
							for (var item = 0; item < day.ScheduleServices.Count(); item++)
							{
								@Html.Raw(item > 0 ? "<br />" : string.Empty)
								@(day.ScheduleServices.ElementAt(item) != null ? day.ScheduleServices.ElementAt(item).Name : string.Empty)
							}
						}
					</td>
					<td>
						@if (day.ScheduleServices != null && day.ScheduleServices.Any())
						{
							for (var item = 0; item < day.ScheduleServices.Count(); item++)
							{
								@Html.Raw(item > 0 ? "<br />" : string.Empty)
								@(day.ScheduleServices.ElementAt(item) != null ? day.ScheduleServices.ElementAt(item).Time.ToString(@"hh\:mm") : string.Empty)
							}
						}
					</td>
				</tr>
			}
		</table>
	</div>
}
